#pragma once

#include <QObject>
#include <qsqldatabase.h>

class UseMySql : public QObject
{
	Q_OBJECT

public:
	UseMySql(QObject *parent = nullptr);
	~UseMySql();

public:
	static UseMySql* instance();

	QString getDepartmentIdFromDepName(QString name);
	QString getDepartmentNameFromId(QString id);

	bool getDepartmentInfo(QString id, QStringList& fields,QVector<QVector<QString>>& info);
	bool getEmployeeInfo(QString id, QStringList& fields, QVector<QString>& info);

	QString addEmployee(QString departmentID,QString employeeName,QString picture);

	bool deleteEmployee(QString id);

private:
	bool connectMySql();

private:
	QSqlDatabase base;

};
